import {createRouter, createWebHistory} from 'vue-router'
import HomeView from '../views/HomeView.vue'

const routes = [
    {
        path: '/',
        name: 'home',
        component: HomeView,
        redirect: '/index/recommend',
        children: [
            {
                path:'/detail',
                name:'bookdetail',
                component: ()=>import('../views/bookstore/BookDetailView')
            },
            {
                path: '/zvideo/upload-video',
                name: 'video',
                component: () => import('../views/content/PostVideoView.vue')
            },
            {
                path: '/setup',
                name: 'setup',
                component: () => import('../views/SetUpView'),
                redirect: '/setup/account',
                children: [
                    {
                        path: 'account',
                        name: 'account',
                        component: () => import('../views/setup/AccountView')
                    },
                    {
                        path: 'message',
                        name: 'message',
                        component: () => import('../views/setup/MessageView')
                    },
                    {
                        path: 'hide',
                        name: 'hide',
                        component: () => import('../views/setup/HideView')
                    },
                    {
                        path: 'privacy',
                        name: 'privacy',
                        component: () => import('../views/setup/PrivacyView')
                    },
                    {
                        path: 'preferences',
                        name: 'preferences',
                        component: () => import('../views/setup/PreferencesView')
                    },
                    {
                        path: 'card',
                        name: 'card',
                        component: () => import('../views/setup/CardView')
                    }
                ]
            },
            {
                path: '/goods',
                name: 'goods',
                component: () => import('../views/GoodsView'),
            },
            {
                path: '/goods',
                name: 'goods',
                component: () => import('../views/GoodsView'),
                // redirect: '/goods/detail',
            },
            {
                path: '/index',
                name: 'index',
                component: () => import('../views/IndexView'),
                children: [
                    {
                        path: 'hot',
                        component: () => import('../views/home/HotView'),
                    }, {
                        path: 'recommend',
                        component: () => import('../views/home/RecommendView')
                    }, {
                        path: 'video',
                        component: () => import('../views/home/VideoView')
                    }, {
                        path: 'concern',
                        component: () => import('../views/home/ConcernView')
                    }
                ]
            },
            {
                path: '/personal',
                name: 'personal',
                component: () => import('../views/PersonalView'),
                redirect:'/personal/dynamic',
                children: [
                    {
                        path: 'answer',
                        component: () => import('../views/personal/AnswerView'),
                    },                     {
                        path: 'article',
                        component: () => import('../views/personal/ArticleView'),
                    },                    {
                        path: 'collection',
                        component: () => import('../views/personal/CollectionView'),
                    },                    {
                        path: 'column',
                        component: () => import('../views/personal/ColumnView'),
                    },                    {
                        path: 'dynamic',
                        component: () => import('../views/personal/DynamicView'),
                    },                    {
                        path: 'follow',
                        component: () => import('../views/personal/FollowView'),
                    },                    {
                        path: 'idea',
                        component: () => import('../views/personal/IdeaView'),
                    },                    {
                        path: 'question',
                        component: () => import('../views/personal/QuestionView'),
                    },                    {
                        path: 'vedio',
                        component: () => import('../views/personal/VedioView'),
                    },
                ]
            },
            {
                path: '/creator',
                component: () => import('../views/create/Creator.vue'),
                redirect:'/creator/center',
                children: [
                    {
                        path: 'center',
                        component: () => import('../views/create/Center'),
                    }
                    , {
                        path: 'featured-question',
                        component: () => import('../views/create/question/featured-question.vue')
                    },{
                        path: 'creation',
                        component: () => import('../views/create/manage/creation.vue')
                    }
                ]
            },
            {
                path: '/write',
                name: 'write',
                component: () => import('../views/content/PostArticleView.vue')
            },
        ],
    },
    {
        path: '/alipay',
        name: 'alipay',
        component: () => import('../views/AliPayView.vue')
    },
    {
        path: '/login',
        component: () => import(/* webpackChunkName: "about" */ '../views/loginView.vue')
    },
    {
        path: '/register',
        component: () => import(/* webpackChunkName: "about" */ '../views/RegView.vue')
    },
]

const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes
})

export default router
